package com.example.leetdemo.finash;

public class Solution1220 {

    public int countVowelPermutation(int n) {
        int MOD = 1000000007;
        int[][] dp = new int[n][5];
        dp[0][0] = 1;
        dp[0][1] = 1;
        dp[0][2] = 1;
        dp[0][3] = 1;
        dp[0][4] = 1;
        for (int i = 1; i < n; i++) {
            dp[i][0] = ((dp[i - 1][1] + dp[i - 1][2]) % MOD + dp[i - 1][4]) % MOD;
            dp[i][1] = (dp[i - 1][0] + dp[i - 1][2]) % MOD;
            dp[i][2] = (dp[i - 1][1] + dp[i - 1][3]) % MOD;
            dp[i][3] = dp[i - 1][2] % MOD;
            dp[i][4] = (dp[i - 1][2] + dp[i - 1][3]) % MOD;
        }
        int result = 0;
        for (int i = 0; i < 5; i++) {
            result = (result + dp[n - 1][i]) % MOD;
        }
        return result;
    }

    public static void main(String[] args) {
        Solution1220 solution1220 = new Solution1220();
        System.err.println(solution1220.countVowelPermutation(10000));
    }
}
